
function initPage() {
	
	 
	$('div.c_right').tabs({
		containerClass: "c_r_body",
		selectedClass: "on",
		hash: true
	});
	//\u67e5\u8be2\u4fe1\u606f\u5217\u8868
	$('#scform').submit(function(){
		var data = $(this).serializeArray();
		loadObjRsList(data);	
		return false;
	});
	/*\u8f93\u5165\u6846\u4fe1\u606f\u6821\u9a8c
	$("#card_Validate").keyup(function(){
		var v = this.value.replace(/[^\d]/g, '').toInt();
		var c = $('#credit').text().toInt();
		if (v > c) v = c;
		rate = $('#rate').val().toInt();
		this.value = v;
		$('#point').html(v*rate+'');
	});*/
	//\u6dfb\u52a0\u4fe1\u606f\u52a8\u4f5c
	$('#form_card_add').submit(function(){
		var form = $(this);
		var msg = $("#result");
		var data = form.serializeArray();
		msg.warning(TXT_POSTDATA);
		form.disabled();
		$.ajax({
			type: "POST",
			url: form.attr("action")+"?act=add",
			data: data,
			dataType: "json",
			success: function(ret){
				msg.warning(ret.msg);		
				if (ret.success) {
					var d = ret.url ? ret.url : "/";
					setTimeout( function() {									
						window.location = d;
					}, 800)
				} else {
					form.enabled();
				}				
			},
			error: function(res){
				alert("error");
				msg.warning(TXT_NETBUSY);
				form.enabled();
			}
		});
		return false;
	});
}
//\u586b\u5145json\u6570\u636e
function loadObjRsList(data) {	
	//\u5c06action\u8fd4\u56de\u7684json\u653e\u5165\u4e34\u65f6div_load_temp\u4e2d\u4fdd\u5b58
	$("#div_load_json_temp").html(TXT_NETWAIT).load($("#scform").attr("action")+"?act=search", data, function() { 
		eval("var obj_json_data ="+$("#div_load_json_temp").html()+";"); 
		$('#div_rslist').html(TrimPath.processDOMTemplate("template_jst", obj_json_data));
	});   
}



function rs_el_Delete(a) {
	if (!a) {
		a = [];
		$("#scform :checkbox[name='id_all']:enabled:checked").each(
				function() { 
					a.push(this.value)
				});
		a = a.join(",")
	} 
	if (!a) {
		return alert("\u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u8bb0\u5f55")
	}
	if (!confirm("\u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u8bb0\u5f55\uff1f")) {
		return
	}
	form = $("#scform");
	form.disabled();
	$.ajax( {
		type :"POST",
		url :form.attr("action")+"?act=delete",
		data : {
			act :"delete",
			id :a
		},
		dataType :"json",
		success : function(b) {
			if (b.success) {
				form.submit();//\u52a0\u8f7d\u6570\u636e
				form.enabled()
			} else {
				alert(b.msg);
				form.enabled()
			}
		},
		error : function(b) {
			alert(TXT_NETBUSY);
			form.enabled()
		}
	})
};
